package com.scaleit.weighingsystem;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class lvVehicles extends ListActivity
{
	private String[] TEST_VEHICLES = new String [] {"Add new vehicle...", "Test Vehicle 1", "Test Vehicle 2", "Test Vehicle 3", "Test Vehicle 4", "Test Vehicle 5", "Test Vehicle 6", "Test Vehicle 7", "Test Vehicle 8", "Test Vehicle 9", "Test Vehicle 10"};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		setListAdapter(new ArrayAdapter<String>(this, R.layout.single_item, TEST_VEHICLES));
		
		ListView list = getListView();
		list.setTextFilterEnabled(true);
		list.setOnItemClickListener(new OnItemClickListener(){

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				//Toast.makeText(getApplicationContext(),((TextView)arg1).getText(), Toast.LENGTH_LONG).show();
				Intent iAccount = new Intent("com.scaleit.weighingsystem.EDITVEHICLE");
				iAccount.putExtra("VEHICLENAME", ((TextView)arg1).getText());
				startActivity(iAccount);
			}
			
		});
	}

}
